Repository navigation
fix(ts): a .tsx call takes no lone method of its name past a .ts one - #3500
Closed
inth3shadows wants to merge 1 commit into
Closed
inth3shadows wants to merge 1 commit into
inth3shadows wants to merge 1 commit into
Conversation
Name matching keeps TypeScript and TSX apart (1662), so for a .tsx caller a .ts class's method of the name was set aside, and the one .tsx method left was taken as the only method of the name at 0.7. On excalidraw that linked 27 scene.mutateElement(...) calls in .tsx files to App.mutateElement, where the compiler resolves Scene.mutateElement in scene.ts. The same held from a .ts caller past a .tsx method. The lone guess is now skipped when a method of the name in the other of the two languages would have passed the by-name filters (test files, dispatched view actions, a receiver's declared type, lexical reach, React lifecycle methods, test constructor functions) and is not in the lone method's own class hierarchy (an interface or abstract method it implements, or an override). Receiver-name scoring is untouched. JavaScript, JSX, Vue, Svelte and Astro callers are unchanged. Fixes 3443.
inth3shadows
added a commit
to inth3shadows/codegraph
that referenced
this pull request
Nov 27, 2026
# Conflicts: # CHANGELOG.md
inth3shadows
added a commit
to inth3shadows/codegraph
that referenced
this pull request
Nov 27, 2026
…o lone method past a .ts one, colbymchenry#3443)
Contributor
Author
|
Closing: #3524 landed this fix on 2026-11-29. Thanks for carrying it. |
inth3shadows
added a commit
to inth3shadows/codegraph
that referenced
this pull request
Dec 3, 2026
…1.6.7) Took upstream's side where it merged our PRs as its own: - colbymchenry#3309 named pipes -> upstream colbymchenry#3521 (fork's readRegularFile and the config-file-fifo test removed; the compile_commands.json read keeps upstream's readRegularFileSync, which colbymchenry#3521 did not cover) - colbymchenry#3418 prompt hook under umask 0002 -> upstream colbymchenry#3523 (fork test removed) - colbymchenry#3499/colbymchenry#3500 canvas context and .tsx lone guess -> upstream colbymchenry#3524 (fork code and ts-tsx-lone-guess test removed; the calls colbymchenry#3524 drops are colbymchenry#3607, its missed case colbymchenry#3608) - colbymchenry#3226 variance -> upstream colbymchenry#3520 - the fork's Java wildcard static-call copy (colbymchenry#3138) -> upstream's own visibility check; the fork test still passes on upstream code Kept fork-only: Bash, the CommonJS missing member, member call on an imported function, the TypeScript grammar fork, the short MCP instructions (colbymchenry#1529), and import-type default exports (export * never forwards a default; an explicit default with none resolvable links nothing). Kernel build.rs/langs.rs: union of the vendored TypeScript grammar and upstream's new vendored grammars.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3443
What
In a
.tsxfile, a method call on a value codegraph can't type was linked to the only.tsxmethod of that name, even when a.tsfile has a method of the same name. On excalidraw this sent 27scene.mutateElement(…)calls in components (for example Stats/Angle.tsx#L49) toApp.mutateElementinApp.tsx. The compiler resolves them toScene.mutateElementinscene.ts. The same thing happened from a.tscaller past a.tsxmethod.Those calls now link nothing instead of the wrong method. The issue's
destructuredandplaincallers no longer callApp.mutateElement, andannotatedstill callsScene.mutateElementat 0.9.How
Name matching keeps TypeScript and TSX apart on purpose (#1662), so the by-name step sets a
.tsmethod aside for a.tsxcaller. The.tsxmethod left over was then taken as "the only method of the name" at 0.7. Now that guess is skipped when a method of the name in the other of the two languages:What stays as on
main:Designs I tried and dropped during review:
.tsand.tsxas one language in the by-name step. fix(resolution): don't believe a bare-name call across language families #1662 separated them because a name-only pick across the two went to the wrong declaration more often than to the right one.render, a function-local class, an interface the lone class implements, or a test helper outside the test suites made correct edges disappear.cache.aadd()→BaseCache). The check now gates only the lone guess..js/.tsand Vue projects, which nothing here measured.Measured (base
3c230869878559f3f96bf5580b2d2c66dcf138e7vs this branch,CODEGRAPH_KERNEL=0, Node 22, Linux x64)__tests__/ts-tsx-lone-guess.test.ts: 17/17 pass. Onmain, the 4 tests that check a removed guess fail and the other 13 pass.dd2f8fc32b92cbf56f4abee6a0cf3b14681b4b55: 31callsedges removed, none added. ky3541888878c4d303a8bc2ad61815f4e048f55a5dand express43fca52d28a422c8be48fd489cbd4f2d6152bab6: no edge changes.daemon-proof,prompt-hook-daemonandprompt-hook-daemon-busy. Those 9 fail the same way onmainhere, where the prompt hook can't reach the daemon under umask 0002 (Prompt hook: never reaches the running daemon when the umask is 0002 (Ubuntu's default) #3417).tsc --noEmitexits 0. Tested on Linux only.Checked with graph-assay
I maintain graph-assay. Its issue-3443 fixture reads BROKEN on
main(3c230869). On this branch it reads CHANGED: the two wrong edges are gone, and the two right ones (toScene.mutateElement) are still missing, because this change removes a guess and adds no typing. No other fixture verdict changed.Side effects on excalidraw, checked against scip-typescript:
scene.mutateElement(…)→App.mutateElement, all wrong (the compiler resolvesScene#mutateElement).app.focusContainer()→ theAppClassProperties.focusContainerinterface member: wrong. The compiler resolvesApp#focusContainer, a.tsxmethod of the same name.controller.close()→LaserPointer.close: wrong. The compiler resolves the DOM'sReadableStreamDefaultController#close.excalidrawAPI?.refresh()→App.refresh: the compiler records no reference at either site.AppTextTool.refreshinApp.textTool.tsis a second method of that name, so the guess is no longer taken.Known limits
Scene.mutateElementneeds the receiver's type, from a destructured props parameter,const { scene } = appor a callback type. That is a separate change..tsxSceneView.mutateElementcan win overScene.mutateElementinscene.ts.implementsa type alias, a globaldeclare interfacefrom a.d.ts, orextends Mix(Base)— isn't recognised as sharing a hierarchy with the declaration it implements. Its lone method then loses the guess when that declaration is in the other language.